﻿using DTOs;
using MediatR;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.UserRoleCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.UserRoleHanders
{
    public class UserRoleShowCommandHandler : IRequestHandler<UserRoleShowCommand, List<UserRoleDto>>
    {
        private readonly IUserRoleService _userRoleService;
        public UserRoleShowCommandHandler(IUserRoleService userRoleService)
        {
            _userRoleService = userRoleService;
        }

        public async Task<List<UserRoleDto>> Handle(UserRoleShowCommand request, CancellationToken cancellationToken)
        {
            return await _userRoleService.GetUserRole(request.roleId);
        }
    }
}
